function getSystemTime ()
{
    //1. 创建一个ajax对象
    var ajax = new XMLHttpRequest();

    //2. 创建一个HTTP请求
    ajax.open("get","http://localhost:8080/ajax/time/now",true);

    //4. 监听请求状态的改变
    ajax.onreadystatechange = function()
    {
        //readySate == 4 获取到相应.Format("yyyy-MM-dd HH:mm:ss")
        if (ajax.readyState == 4)
        {
            var result = eval("("+ajax.responseText+")");
            var time = getFomateTime(result.data);
            document.getElementById('time').innerHTML = time;
        }
    }

    //3. 发送请求
    ajax.send();
}

function getFomateTime(data)
{
    var date = new Date(data);
    var Y = date.getFullYear() + '-';
    var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
    var D = date.getDate() + ' ';
    var h = date.getHours() + ':';
    var m = date.getMinutes() + ':';
    var s = date.getSeconds();
    var time = Y+M+D+h+m+s;
    return time;
}